package top.leyi.utils;


import org.springframework.stereotype.Repository;

@Repository("RandomString")
public class RandomString {

	private final static String str = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    public static String getRandomString(int len, String... strs){
     
       String key = str;
       if(strs.length>0){
    	   key = strs[0];
       }
    	           	   
       int keyL = key.length();
	   StringBuffer sb = new StringBuffer();
       for(int i =0; i<len; i++){
	       sb.append(key.charAt((int)(Math.random()*keyL)));
       }
	   return sb.toString();
    }

}
